{{#if block.blocks}}
  {{yield}}
{{else}}
  {{#if canvasLinkComponent}}
    {{component canvasLinkComponent
      blockID=block.id
      canvasID=canvasID
      filter=filterTerm
      local-class='block-link'}}
  {{/if}}

  <div local-class="block">
    {{yield (hash
              isFocused=isFocused
              onBlurBlock=(action 'onBlur')
              onFocusBlock=(action 'onFocus'))}}
  </div>

  {{#if commentsEnabled}}
    {{#with (hash blockComments=(filter-by 'blockID' block.id comments)) as |scope|}}
      <button
        local-class="comment-thread-indicator {{if scope.blockComments 'has-comments'}}"
        onclick={{toggle-action 'block.showCommentThread' this}}>
      </button>

      {{#if block.showCommentThread}}
        <div local-class="comment-thread">
          {{component commentThreadComponent
            blockId=block.id
            blockComments=scope.blockComments
            comments=comments}}
        </div>
      {{/if}}
    {{/with}}
  {{/if}}
{{/if}}